//
//  LCYCollectionArticleController.m
//  EPA
//
//  Created by lanou3g on 16/4/26.
//  Copyright © 2016年 liu. All rights reserved.
//

#import "LCYCollectionArticleController.h"
#import "LCYNetWorkRequestManager.h"
#import "LCYDBManager.h"
@interface LCYCollectionArticleController ()<UIWebViewDelegate>

@end

@implementation LCYCollectionArticleController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = self.homeModel.title;
    
    UIWebView *webView = [[UIWebView alloc]initWithFrame:self.view.frame];
    [self.view addSubview:webView];
    
    [LCYNetWorkRequestManager requestURL:[NSURL URLWithString:@"http://api2.pianke.me/article/info"] RequestMethod:LCY_POST Params:@{@"contentid":self.homeModel.ID,@"client":@"1",@"deviceid":@"63A94D37-33F9-40FF-9EBB-481182338873",@"auth":@"Wc06FCrkoq1DCMVzGMTikDJxQ8bm3Mrm2NpT9qWjwzcWP23tBKQx1c4P0",@"version":@"3.0.2"} Result:^(NSData *data, NSURLResponse *response, NSError *error) {
        if (data) {
            NSLog(@"%@",[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]);
            NSMutableDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            NSDictionary *dataDic = jsonDic[@"data"];
            
            dispatch_async(dispatch_get_main_queue(), ^{
                [webView loadHTMLString:dataDic[@"html"] baseURL:nil];
            });
        }
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
